////////////////////////////////////////////////////////////////////////////////
//File:					UglyApplication.h
//Author:				Kesitem
//This file is part of UglyProject.
//See UglyProject.txt for copyright informations.
////////////////////////////////////////////////////////////////////////////////
#ifndef __UGLYAPPLICATION_H__
#define __UGLYAPPLICATION_H__

#include "UglyCore.h"

namespace Ugly
{

/**
 * \brief Application base class.
 */
class Application
{
public:

    /**
     * \brief Default constructor.
     */
    Application();

    /**
     * \brief Destructor.
     */
    virtual ~Application();

    /**
     * \brief Run the application
     *
     * \return Return code of the application
     */
    int run();

    /**
     * \brief Request end of the application.
     */
    void quit();

protected:

    /**
     * \brief Init the application.
     *
     * \return False if error.
     */
    virtual bool init();

    /**
     * \brief Shutdown the application.
     */
    virtual void shutdown();

    /**
     * \brief Update the application.
     *
     * \return False if error.
     */
    virtual bool update();

private:

    /**
     * \brief Create application.
     *
     * \return False if error.
     */
    bool create();

    /**
     * \brief Destroy application.
     */
    void destroy();

    /**
     * \brief Main loop.
     *
     * \return False if error.
     */
    bool mainLoop();

protected:

    /**
     * Quit flag
     */
    bool mQuit;
    /**
     * SDL Window.
     */
    SDL_Window *mWindow;
    /**
     * OpenGL context.
     */
    SDL_GLContext mGLContext;
};

}//namespace Ugly

#endif//__UGLYAPPLICATION_H__
